/*******************************************************************************
* Copyright (c) 2010, 2018 西安秦晔信息科技有限公司
* Licensed under the Apache License, Version 2.0 (the "License");
*    you may not use this file except in compliance with the License.
*    You may obtain a copy of the License at
*
*       http://www.apache.org/licenses/LICENSE-2.0
*
*    Unless required by applicable law or agreed to in writing, software
*    distributed under the License is distributed on an "AS IS" BASIS,
*    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*    See the License for the specific language governing permissions and
*    limitations under the License.
*******************************************************************************/
package com.qinyeit.serviceapp.entity;

import com.alibaba.fastjson.annotation.JSONField;
import com.qinyeit.serviceapp.entity.enums.State;
import com.qinyeit.serviceapp.entity.enums.WayType;
import lombok.Builder;
import lombok.experimental.Tolerate;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.*;
import java.util.Date;

/**
 * ClassName: Charge <br/>
 * Function: 服务费 <br/>
 * date: 2018-11-29 10:03:27 <br/>
 *
 * @author liuwenjin
 * @version  1.0
 * @since JDK 1.8
 */
@Builder
@Entity
@Table(name="charges")
public class Charge extends MerchantGroupBaseEntity<Long> {

	private static final long serialVersionUID = 1L;

	// 服务费编码 
    @Column(name="no", length = 300)
	private String no = null;

	// 服务费名称 
    @Column(name="name", length = 300)
	private String name = null;

	// 收费方式 
    @Column(name="type", length = 300)
	@Enumerated(EnumType.STRING)
	private WayType type = WayType.CONSUMPTION;

	// 消费值 
    @Column(name="value",scale=2)
	private Double value = null;

	// 计时间隔 
    @Column(name="time")
	private Integer time = null;

	// 状态 
    @Column(name="state", length = 300)
	@Enumerated(EnumType.STRING)
	private State state = State.NORMAL;

	// 操作人 
    @Column(name="operator_name", length = 300)
	private String operatorName = null;

	// 操作日期 
	@JSONField(format="yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm")
    @Column(name="operate_time")
	private Date operateTime = null;

	//创建的时候生成 编辑的时候不变
	@Column(name="uuid", length = 300)
	private String uuid = "";

	//更新的时间戳 long
	@Column(name="update_timestamp")
	private Long updateTimestamp = null;

	@Transient
	private String branchs= "";



	@Tolerate
	public Charge() {
		
	}
    @Tolerate
	public Charge(Long id){
    	super.setId(id);
    }
	
	/**
	 * 获取服务费编码
	 */
	public String getNo() {
		return this.no;
	}

    /**
     * 设置服务费编码
     */
	public Charge setNo(String no) {
		this.no = no;
		return this;
	}

	public String getBranchs() {
		return branchs;
	}

	public void setBranchs(String branchs) {
		this.branchs = branchs;
	}

	/**
	 * 获取服务费名称
	 */
	public String getName() {
		return this.name;
	}

    /**
     * 设置服务费名称
     */
	public Charge setName(String name) {
		this.name = name;
		return this;
	}


	/**
	 * 获取消费值
	 */
	public Double getValue() {
		return this.value;
	}

    /**
     * 设置消费值
     */
	public Charge setValue(Double value) {
		this.value = value;
		return this;
	}

	/**
	 * 获取计时间隔
	 */
	public Integer getTime() {
		return this.time;
	}

    /**
     * 设置计时间隔
     */
	public Charge setTime(Integer time) {
		this.time = time;
		return this;
	}


	/**
	 * 获取操作人
	 */
	public String getOperatorName() {
		return this.operatorName;
	}

    /**
     * 设置操作人
     */
	public Charge setOperatorName(String operatorName) {
		this.operatorName = operatorName;
		return this;
	}

	/**
	 * 获取操作日期
	 */
	public Date getOperateTime() {
		return this.operateTime;
	}

    /**
     * 设置操作日期
     */
	public Charge setOperateTime(Date operateTime) {
		this.operateTime = operateTime;
		return this;
	}

	public WayType getType() {
		return type;
	}

	public void setType(WayType type) {
		this.type = type;
	}

	public State getState() {
		return state;
	}

	public void setState(State state) {
		this.state = state;
	}

	public String getUuid() {
		return uuid;
	}

	public void setUuid(String uuid) {
		this.uuid = uuid;
	}

	public Long getUpdateTimestamp() {
		return updateTimestamp;
	}

	public void setUpdateTimestamp(Long updateTimestamp) {
		this.updateTimestamp = updateTimestamp;
	}
}
